function login() {
	var userName = $.trim($("#userName").val());
	var userPwd = $.trim($("#userPwd").val());


	if (userName != null && userPwd != null) {
		// Ajax请求
		$.post('user/login', {
			userName: userName,
			userPwd: userPwd
		}, function(result) {
			if (result == 'success') {
				alert("登录成功!");
				window.location = "http://localhost:8080/CRMSystem2/admin.html"
			} else{
				alert("用户名或密码不正确!");
				window.location = "http://localhost:8080/CRMSystem2/login.html"
			}
		});
	}
}

function logOut() {
	$.messager.confirm('确认', '确认退出系统吗？', function(r) {
		if (r) {
			$.post('user/logOut', {
			}, function(result) {
				if (result == 'success') {
					alert("退出成功,返回登录界面!");
					window.location = "http://localhost:8080/CRMSystem2/login.html"
				} else {
					alert("退出异常!");
					window.location = "http://localhost:8080/CRMSystem2/admin.html"
				}
			});
		}
	});
};

